package com.twoGroup.boot.controller;

import com.twoGroup.boot.pojo.*;
import com.twoGroup.boot.service.AdminService;
import com.twoGroup.boot.utils.AdminUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/admin")
@Api(tags = "管理员接口")
public class AdminController {
    public static Logger logger = LoggerFactory.getLogger(AdminController.class);
    private static AdminUtils adminUtils=new AdminUtils();
    /**
     * 声明引用类型， 调用引用类型的业务方法
     * 引用类型自动注入 @Autowired @ReSource
     */
   @Resource
    private AdminService adminService;

    //添加用户
    @ApiOperation(value = "添加用户" ,notes = "通过xxx添加")
    @PostMapping("/addUser")
    @ResponseBody
    public Map<String, Object> adminAddUser(String nickname, String sex, int age, String password, String telephone, String email, String address, String idCard, String rName){
        Map<String, Object> map =new HashMap<>();
    //调用Service，处理业务逻辑，把处理结果返用户
        String msg = adminService.adminAddUser(nickname,sex,age,password,telephone,email,address,idCard,rName);
        map.put("msg",msg);
        return map;
        }

    //删除用户
    @ApiOperation(value = "删除用户" ,notes = "通过xxx删除")
    @PostMapping("/deleteUser")
    @ResponseBody
    public Map<String, Object> adminDeleteUser(int userId){

        //调用Service，处理业务逻辑，把处理结果返用户
        String msg = adminService.adminDeleteUser(userId);
        Map<String, Object> map =new HashMap<>();
        map.put("msg",msg);
        return map;
    }
    //删除用户
    @ApiOperation(value = "批量删除用户" ,notes = "通过userId删除")
    @PostMapping("/deleteUsers")
    @ResponseBody
    public Map<String, Object> adminDeleteUsers(@RequestParam("userIds") Integer[] userIds){
        Map<String, Object> map =new HashMap<>();
        String msg = "删除失败！！！";
        try {
            int rows = adminService.adminDeleteUsers(userIds);

            if (rows > 0) {
                msg = "删除成功";
            }
        }
        catch (Exception e){
            e.printStackTrace();
        }
        map.put("msg",msg);
        return map;

//        int row=adminService.deleteManyUser(userIds);
//        String msg = "删除失败！！！";
//        if (row > 0) {
//            msg = "删除成功";
//           }
//                Map<String,Object> map =new HashMap<>();
//        map.put("msg",msg);
//        return map;
    }
    //修改用户
    @ApiOperation(value = "修改用户" ,notes = "修改")
    @PostMapping("/updateUser")
    @ResponseBody
    public Map<String, Object> adminUpdateUser(int userId, String nickname, String sex,String telephone,String rName){
        //调用Service，处理业务逻辑，把处理结果返用户
        String msg = adminService.adminUpdateUser(userId,nickname,sex,telephone,rName);
        Map<String, Object> map =new HashMap<>();
            map.put("msg",msg);
        return map;
    }
    //查询用户
    @ApiOperation(value = "根据id查询用户全部信息" ,notes = "通过ID查询用户")
    @PostMapping("/queryUser")
    @ResponseBody
    public List<User> adminQueryUser(int userId){
        return adminService.adminQueryUser(userId);
    }

    //添加商家
    @ApiOperation(value = "添加商家" ,notes = "通过xxx添加")
    @PostMapping("/addShopper")
    @ResponseBody
    public Map<String, Object> adminAddShopper(String nickname, String sex, int age, String password, String telephone, String email, String address, String idCard, String rName){

        //调用Service，处理业务逻辑，把处理结果返用户
        String msg = adminService.adminAddShopper(nickname,sex,age,password,telephone,email,address,idCard,rName);
        Map<String, Object> map =new HashMap<>();
        map.put("msg",msg);
        return map;
    }
    //删除商家
    @ApiOperation(value = "删除商家" ,notes = "通过xxx删除")
    @PostMapping("/deleteShopper")
    @ResponseBody
    public Map<String, Object> adminDeleteShopper(int userId){
        ModelAndView mv = new ModelAndView();
        //调用Service，处理业务逻辑，把处理结果返用户
        String msg= adminService.adminDeleteShopper(userId);
        Map<String, Object> map = new HashMap<>();
        map.put("msg",msg);
        return map;
    }
//    删除商家
    @ApiOperation(value = "批量删除商家" ,notes = "通过userId删除")
    @PostMapping("/deleteShoppers")
    @ResponseBody
    public Map<String, Object> adminDeleteShoppers(Model model, @RequestParam("UserId") Integer[] userIds){
        Map<String, Object> map =new HashMap<>();
        String msg="删除失败！！！";
        try {
            int rows = adminService.adminDeleteShoppers(userIds);

            if (rows > 0) {
                //注册成功，给用户成功的数据和视图
                msg = "删除成功";
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
                map.put("msg",msg);
                return map;
    }
    //修改商家
    @ApiOperation(value = "修改商家" ,notes = "修改")
    @PostMapping("/updateShopper")
    @ResponseBody
    public Map<String, Object> adminUpdateShopper(int userId, String nickname, String sex, int age, String password, String telephone, String email, String address, String idCard, String rName){
        //调用Service，处理业务逻辑，把处理结果返用户
        String msg = adminService.adminUpdateShopper(userId,nickname,sex,age,password,telephone,email,address,idCard,rName);
        Map<String, Object> map =new HashMap<>();
        map.put("msg",msg);
        return map;
    }
    //查询商家
    @ApiOperation(value = "根据id查询商家全部信息" ,notes = "通过ID查询用户或商家")
    @PostMapping("/queryShopper")
    @ResponseBody
    public List<User> adminQueryUserOrShopper(int userId){

        return adminService.adminQueryShopper(userId);
    }


    //删除商品
    @ApiOperation(value = "删除商品" ,notes = "通过xxx删除")
    @PostMapping("/deleteGoods")
    @ResponseBody
    public Map<String, Object> adminDeleteGoods(int goodsId){

        //调用Service，处理业务逻辑，把处理结果返用户
       String msg = adminService.adminDeleteGoods(goodsId);
        logger.info(msg);
        Map<String, Object> map=new HashMap<>();
        map.put("msg",msg);
        return map;
    }
    //    删除商品
    @ApiOperation(value = "批量删除商品" ,notes = "通过goodsId删除")
    @PostMapping("/deleteMoreGoods")
    @ResponseBody
    public Map<String, Object> adminDeleteMoreGoods(Model model, @RequestParam("goodsId") Integer[] goodsIds){
        Map<String, Object> map =new HashMap<>();
        String msg="删除失败！！！";
        try{int rows = adminService.adminDeleteMoreGoods(goodsIds);
            if(rows>0){
                //注册成功，给用户成功的数据和视图
                msg ="删除成功";
            }
        }
        catch (Exception e)  {
            e.printStackTrace();
            }
        map.put("msg",msg);
        return map;
    }

    //修改商品
//    @ApiOperation(value = "修改商品信息" ,notes = "修改")
//    @PostMapping("/updateGoods")
//    public ModelAndView updateGoods(Goods goods){
//        ModelAndView mv = new ModelAndView();
//        //调用Service，处理业务逻辑，把处理结果返用户
//        int rows = adminService.adminUpdateGoods(goods);
//        String msg="修改失败！！！";
//        if(rows>0){
//            //注册成功，给用户成功的数据和视图
//            msg ="修改成功";
//        }
//        mv.addObject("msg",goods.getGoodsName()+","+msg);
//        mv.setViewName("index");
//        return mv;
//    }
//    //查询商品
//    @ApiOperation(value = "查询商品" ,notes = "通过xxx查询")
//    @PostMapping("/QueryGoods")
//    public ModelAndView adminQueryGoods(int goodsId){
//        ModelAndView mv = new ModelAndView();
//        //调用Service，处理业务逻辑，把处理结果返用户
//        List<GoodsAndShopAndGoodsTypeAndGoodsBrand> list = adminService.adminQueryGoods(goodsId);
//        String msg="查询失败！！！";
//        if(list!=null){
//            //查询成功，给用户成功的数据和视图
//            msg ="查询成功";
//        }
//        logger.info("==================================");
//        logger.info(list);
//        mv.addObject("msg",goodsId+","+msg);
//        mv.setViewName("index");
//        return mv;}
//    //删除商品
//    @ApiOperation(value = "批量删除商品" ,notes = "通过goodsId删除")
//    @PostMapping("/deleteMoreGoods")
//    @ResponseBody
//    public String adminDeleteMoreGoods(@RequestParam("goodsId") ArrayList<Integer> goodsIds){
//        int rows =0;
//        for (Integer goodsId : goodsIds) {
//            rows= adminService.adminDeleteGoods(goodsId);
//        }
////        int rows = adminService.adminDeleteUsers(userIds);
//        String msg="删除失败！！！";
//        if(rows>0){
//            //注册成功，给用户成功的数据和视图
//            msg ="删除成功";
//        }
//        return "redirect:/admin/selectGoodsByPage";
//    }


    //删除店铺
    @ApiOperation(value = "删除店铺" ,notes = "通过xxx删除")
    @PostMapping("/deleteShop")
    @ResponseBody
    public Map<String, Object> adminDeleteShop(int shopId){
        //调用Service，处理业务逻辑，把处理结果返用户
        String msg = adminService.adminDeleteShop(shopId);
        Map<String, Object> map=new HashMap<>();
        map.put("msg",msg);
        return map;
    }
    //删除店铺
    @ApiOperation(value = "批量删除店铺" ,notes = "通过shopId删除")
    @PostMapping("/deleteShops")
    @ResponseBody
    public Map<String, Object> adminDeleteShops(Model model, @RequestParam("shopId") Integer[] shopIds){
        String msg="删除失败！！！";
        Map<String, Object> map =new HashMap<>();
        try{int rows = adminService.adminDeleteShops(shopIds);
            if(rows>0){
                //注册成功，给用户成功的数据和视图
                msg ="删除成功";
            }
//            Map<String,Object> map =new HashMap<>();
            }
        catch (Exception e){
            map.put("msg",msg);
            e.printStackTrace();
        }
        return map;
    }
//    //查询店铺
//    @ApiOperation(value = "查询店铺" ,notes = "通过xxx查询")
//    @PostMapping("/queryShop")
//    public ModelAndView adminQueryShop(int shopId){
//        ModelAndView mv = new ModelAndView();
//        //调用Service，处理业务逻辑，把处理结果返用户
//        List<ShopAndUser> list = adminService.adminQueryShop(shopId);
//        String msg="查询失败！！！";
//        if(list!=null){
//            //查询成功，给用户成功的数据和视图
//            msg ="查询成功";
//        }
//        logger.info("=======");
//        logger.info(list);
//        mv.addObject("msg",shopId+","+msg);
//        mv.setViewName("index");
//        return mv;}


//        申请管理列表
//    同意用户成为商家
@ApiOperation(value = "同意用户成为商家" ,notes = "通过xxx添加")
@PostMapping("/agreeUserToBeShopper")
@ResponseBody
public Map<String, Object> agreeUserToBeShopper(int userId){
    //调用Service，处理业务逻辑，把处理结果返用户
    int rows = adminService.agreeUserToBeShopper(userId);
    String msg="操作失败！！！";
    if(rows>0){
        //查询成功，给用户成功的数据和视图
        msg ="操作成功";
    }
    Map<String, Object> map =new HashMap<>();
    map.put("msg",msg);
    return map;

    }
//不同意用户成为商家
    @ApiOperation(value = "不同意用户成为商家" ,notes = "通过xxx修改")
    @PostMapping("/disagreeUserToBeShopper")
    @ResponseBody
    public Map<String, Object> disagreeUserToBeShopper(int userId) {

        //调用Service，处理业务逻辑，把处理结果返用户
        int rows = adminService.disagreeUserToBeShopper(userId);
        String msg = "操作失败！！！";
        if (rows > 0) {
            //查询成功，给用户成功的数据和视图
            msg = "操作成功";
        }
        Map<String, Object> map = new HashMap<>();
        map.put("msg", msg);
        return map;
    }
//        同意商品上架
    @ApiOperation(value = "同意商品上架" ,notes = "通过xxx修改")
    @PostMapping("/agreeGoodsToBePutOnSale")
    @ResponseBody
    public Map<String, Object> agreeGoodsToBePutOnSale(int goodsId){
        //调用Service，处理业务逻辑，把处理结果返用户
       int rows = adminService.agreeGoodsToBePutOnSale(goodsId);
        String msg="操作失败！！！";
        if(rows>0){
            //查询成功，给用户成功的数据和视图
            msg ="操作成功";
        }
        Map<String, Object> map =new HashMap<>();
        map.put("msg",msg);
        return map;
    }

//        不同意商品上架
    @ApiOperation(value = "不同意商品上架" ,notes = "通过xxx修改")
    @PostMapping("/disagreeGoodsToBePutOnSale")
    @ResponseBody
    public Map<String, Object> disagreeGoodsToBePutOnSale(int goodsId){
        //调用Service，处理业务逻辑，把处理结果返用户
        int rows = adminService.disagreeGoodsToBePutOnSale(goodsId);
        String msg="操作失败！！！";
        if(rows>0){
            //查询成功，给用户成功的数据和视图
            msg ="操作成功";
        }

        Map<String, Object> map =new HashMap<>();
        map.put("msg",msg);
        return map;
    }

//        模糊查询
//查询用户
//@ApiOperation(value = "模糊查询用户" ,notes = "通过nickName查询")
//@PostMapping("/likeUserByNickName")
//@ResponseBody
//public List<User> likeUserByNickName(String nickName,int page,int size){
//    PageHelper.startPage(page,size);
//    //调用Service，处理业务逻辑，把处理结果返用户
//    List<User> user = adminService.likeUserByNickName(nickName);
//    PageInfo pageInfo =new PageInfo(user);
//    String msg="查询失败！！！";
//    if(user!=null){
//        //查询成功，给用户成功的数据和视图
//        msg ="查询成功";
//    }
//    logger.info(user);
//    ArrayList arrayList = new ArrayList();
//    arrayList.add(pageInfo);
//
//    return arrayList;}
    //查询商家
//    @ApiOperation(value = "模糊查询商家" ,notes = "通过nickName查询")
//    @PostMapping("/likeShopperByNickName")
//    @ResponseBody
//    public List<User> likeShopperByNickName(String nickName,int page,int size){
//        PageHelper.startPage(page,size);
//        //调用Service，处理业务逻辑，把处理结果返用户
//        List<User> user = adminService.likeShopperByNickName(nickName);
//        PageInfo pageInfo =new PageInfo(user);
//        String msg="查询失败！！！";
//        if(user!=null){
//            //查询成功，给用户成功的数据和视图
//            msg ="查询成功";
//        }
//        logger.info(user);
//        ArrayList arrayList = new ArrayList();
//        arrayList.add(pageInfo);
//
//        return arrayList;}

    //查询商品
//    @ApiOperation(value = "模糊查询商品" ,notes = "通过goodsName查询")
//    @PostMapping("/likeGoods")
//    @ResponseBody
//    public List<GoodsAndShopAndGoodsTypeAndGoodsBrand> likeGoods(String goodsName,int page,int size){
//        PageHelper.startPage(page,size);
//        //调用Service，处理业务逻辑，把处理结果返用户
//        List<GoodsAndShopAndGoodsTypeAndGoodsBrand> goodsAndShopAndGoodsTypeAndGoodsBrands = adminService.likeGoods(goodsName);
//        PageInfo pageInfo =new PageInfo(goodsAndShopAndGoodsTypeAndGoodsBrands);
//        String msg="查询失败！！！";
//        if(goodsAndShopAndGoodsTypeAndGoodsBrands!=null){
//            //查询成功，给用户成功的数据和视图
//            msg ="查询成功";
//        }
//        logger.info(goodsAndShopAndGoodsTypeAndGoodsBrands);
//        ArrayList arrayList = new ArrayList();
//        arrayList.add(pageInfo);
//
//        return arrayList;}

    //查询店铺
//    @ApiOperation(value = "模糊查询店铺" ,notes = "通过nickName查询")
//    @PostMapping("/likeShop")
//    @ResponseBody
//    public List<ShopAndUser> likeShop(String shopName,int page,int size){
//        PageHelper.startPage(page,size);
//        //调用Service，处理业务逻辑，把处理结果返用户
//        List<ShopAndUser> shopAndUsers = adminService.likeShop(shopName);
//        PageInfo pageInfo =new PageInfo(shopAndUsers);
//        String msg="查询失败！！！";
//        if(shopAndUsers!=null){
//            //查询成功，给用户成功的数据和视图
//            msg ="查询成功";
//        }
//        logger.info(shopAndUsers);
//        ArrayList arrayList = new ArrayList();
//        arrayList.add(pageInfo);
//
//        return arrayList;}
//查询申请成为商家的用户
//@ApiOperation(value = "模糊查询申请成为商家的用户", notes = "通过nickName查询")
//@PostMapping("/likeAllUserToBeShopper")
//@ResponseBody
//    public List<User> likeAllUserToBeShopper(String nickName,int page,int size){
//        PageHelper.startPage(page,size);
//        List<User> user =adminService.likeAllUserToBeShopper(nickName);
//    PageInfo pageInfo =new PageInfo(user);
//        String msg = "查询失败！！！";
//        if(user!=null){
//            msg="查询成功";
//        }
//    ArrayList arrayList = new ArrayList();
//    arrayList.add(pageInfo);
//        return arrayList;
//}

//查询申请上架的上商品
//@ApiOperation(value = "模糊查询申请上架的商品", notes = "通过nickName查询")
//@PostMapping("/likeAllGoodsToBePutOnSale")
//@ResponseBody
//    public List<GoodsAndShopAndGoodsTypeAndGoodsBrand> likeAllShopperToBePutOnSale(String goodsName,int page, int size){
//        PageHelper.startPage(page,size);
//        List<GoodsAndShopAndGoodsTypeAndGoodsBrand> goodsAndShopAndGoodsTypeAndGoodsBrands = adminService.likeAllGoodsToBePutOnSale(goodsName);
//    PageInfo pageInfo =new PageInfo(goodsAndShopAndGoodsTypeAndGoodsBrands);
//        String msg = "查询失败！！！";
//        if(goodsAndShopAndGoodsTypeAndGoodsBrands!=null){
//            msg="查询成功";
//    }
//    ArrayList arrayList = new ArrayList();
//    arrayList.add(pageInfo);
//    return arrayList;
//}

    //查询每张表中的数据
//    @ApiOperation(value = "查询所有用户" ,notes = "通过flag查询")
//    @PostMapping("/FindAllUser")
//    @ResponseBody
//    public List FindAllUser(int page,int size) {
//        PageHelper.startPage(page,size);
//        //调用Service，处理业务逻辑，把处理结果返用户
//        List<User> user = adminService.FindAllUser();
//        PageInfo pageInfo =new PageInfo(user);
//        String msg = "查询失败！！！";
//        if (user != null) {
//            //查询成功，给用户成功的数据和视图
//            msg = "查询成功";
//        }
////        model.addAttribute("list", list);
////        mv.addObject("msg", list + "," + msg);
////        mv.setViewName("index");
//        ArrayList arrayList = new ArrayList();
//        arrayList.add(pageInfo);
//        return arrayList;
//
//        }
//
//    @RequestMapping(value = "/KDA")
//    @ResponseBody
//    public List other() {
//        PageHelper.startPage(1,2);
//        List<User> list = adminService.FindAllUser();
//       PageInfo pageInfo=new PageInfo(list,5);
////        Map<String,Object> map=new HashMap<String,Object>();
////        map.put("5个一组的集合",list);
////        map.put("总页数",pageInfo.getPages());
////        map.put("总数居",pageInfo.getTotal());
////        User user=new User();
////        HttpSession session=req.getSession();
////        session.setAttribute("user",user);
////        map.put("水水水水",pageInfo);
////        map.put("导航栏",pageInfo.getNavigatepageNums());
//        ArrayList arer=new ArrayList();
//        arer.add(pageInfo);
//        arer.add(123);
//        return arer;
//
//    }


//    @ApiOperation(value = "查询所有商家" ,notes = "通过flag查询")
//    @PostMapping("/FindAllShopper")
//    @ResponseBody
//    public List<User> FindAllShopper(int page,int size){
//        PageHelper.startPage(page,size);
//        //调用Service，处理业务逻辑，把处理结果返用户
//        List<User> user = adminService.FindAllShopper();
//        PageInfo pageInfo =new PageInfo(user);
//        String msg="查询 失败！！！";
//        if(user!=null){
//            //查询成功，给用户成功的数据和视图
//            msg ="查询成功";
//        }
//        ArrayList arrayList = new ArrayList();
//        arrayList.add(pageInfo);
//
//        return arrayList;}

//    @ApiOperation(value = "查询所有店铺" ,notes = "直接查询")
//    @PostMapping("/FindAllShop")
//    @ResponseBody
//    public List<ShopAndUser> FindAllShop(int page,int size){
//        PageHelper.startPage(page,size);
//        //调用Service，处理业务逻辑，把处理结果返用户
//        List<ShopAndUser> shopAndUsers = adminService.FindAllShop();
//        PageInfo pageInfo =new PageInfo(shopAndUsers);
//        String msg="查询失败！！！";
//        if(shopAndUsers!=null){
//            //查询成功，给用户成功的数据和视图
//            msg ="查询成功";
//        }
//        ArrayList arrayList = new ArrayList();
//        arrayList.add(pageInfo);
//
//        return arrayList;}

//    @ApiOperation(value = "查询所有商品" ,notes = "直接查询")
//    @PostMapping("/FindAllGoods")
//    @ResponseBody
//    public List<GoodsAndShopAndGoodsTypeAndGoodsBrand> FindAllGoods(int page,int size){
//        PageHelper.startPage(page,size);
//        //调用Service，处理业务逻辑，把处理结果返用户
//        List<GoodsAndShopAndGoodsTypeAndGoodsBrand> goodsAndShopAndGoodsTypeAndGoodsBrands = adminService.FindAllGoods();
//        PageInfo pageInfo =new PageInfo(goodsAndShopAndGoodsTypeAndGoodsBrands);
//        String msg="查询失败！！！";
//        if(goodsAndShopAndGoodsTypeAndGoodsBrands!=null){
//            //查询成功，给用户成功的数据和视图
//            msg ="查询成功";
//        }
//        ArrayList arrayList = new ArrayList();
//        arrayList.add(pageInfo);
//        return arrayList;}



//    @ApiOperation(value = "查询所有申请成为商家的用户" ,notes = "通过flag查询")
//    @PostMapping("/FindAllUserToBeShopper")
//    @ResponseBody
//    public List<User> FindAllUserToBeShopper(int page,int size){
//        PageHelper.startPage(page,size);
//        //调用Service，处理业务逻辑，把处理结果返用户
//        List<User> user = adminService.FindAllUserToBeShopper();
//        logger.info(user);
//        PageInfo pageInfo =new PageInfo(user);
//        String msg="查询失败！！！";
//        if(user!=null){
//            //查询成功，给用户成功的数据和视图
//            msg ="查询成功";
//        }
//
//        logger.info(pageInfo);
//        ArrayList arrayList = new ArrayList();
//        arrayList.add(pageInfo);
//        return arrayList;}

    //查询每张表中的数据
//    @ApiOperation(value = "查询所有申请上架的商品" ,notes = "通过goodsFlag查询")
//    @PostMapping("/FindAllGoodsToBePutOnSale")
//    @ResponseBody
//    public List<GoodsAndShopAndGoodsTypeAndGoodsBrand> FindAllGoodsToBePutOnSale(int page,int size){
//        PageHelper.startPage(page,size);
//        //调用Service，处理业务逻辑，把处理结果返用户
//        List<GoodsAndShopAndGoodsTypeAndGoodsBrand> goodsAndShopAndGoodsTypeAndGoodsBrands = adminService.FindAllGoodsToBePutOnSale();
//        PageInfo pageInfo =new PageInfo(goodsAndShopAndGoodsTypeAndGoodsBrands);
//        String msg="查询失败！！！";
//        if(goodsAndShopAndGoodsTypeAndGoodsBrands!=null){
//            //查询成功，给用户成功的数据和视图
//            msg ="查询成功";
//        }
//        ArrayList arrayList = new ArrayList();
//        arrayList.add(pageInfo);
//        return arrayList;}

    //分页操作
    @ApiOperation(value = "分页下的查询所有用户" ,notes = "post方法")
    @PostMapping("/selectUserByPage")
    @ResponseBody
    public Map<String, Object> selectUserByPage(int pageNow, int pageSize){
        com.twoGroup.boot.pojo.Page<User> page = adminService.selectUserByPage(pageNow,pageSize);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",page);
        return map;
    }
    @ApiOperation(value = "分页下的模糊查询用户",notes = "根据nickName查询")
    @PostMapping("/likeUserByPage")
    @ResponseBody
    public Map<String, Object> likeUserByPage(int pageNow, int pageSize, String nickName){
        com.twoGroup.boot.pojo.Page<User> page = adminService.likeUserByPage(pageNow,pageSize,nickName);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",page);
        return map;
    }
    @ApiOperation(value = "分页下的查询所有商家" ,notes = "post方法")
    @PostMapping("/selectShopperByPage")
    @ResponseBody
    public Map<String, Object> selectShopperByPage(int pageNow, int pageSize){
        com.twoGroup.boot.pojo.Page<User> page = adminService.selectShopperByPage(pageNow,pageSize);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",page);
        return map;
    }
    @ApiOperation(value = "分页下的模糊查询商家",notes = "根据nickName查询")
    @PostMapping("/likeShopperByPage")
    @ResponseBody
    public Map<String, Object> likeShopperByPage(int pageNow, int pageSize, String nickName){
        com.twoGroup.boot.pojo.Page<User> page = adminService.likeShopperByPage(pageNow,pageSize,nickName);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",page);
        return map;
    }
    @ApiOperation(value = "分页下的查询所有商品" ,notes = "post方法")
    @PostMapping("/selectGoodsByPage")
    @ResponseBody
    public Map<String, Object> selectGoodsByPage(int pageNow, int pageSize){
        com.twoGroup.boot.pojo.Page<GoodsAndShopAndGoodsTypeAndGoodsBrand> page = adminService.selectGoodsByPage(pageNow,pageSize);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",page);
        return map;
    }
    @ApiOperation(value = "分页下的模糊查询商品",notes = "根据goodsName查询")
    @PostMapping("/likeGoodsByPage")
    @ResponseBody
    public Map<String, Object> likeGoodsByPage(int pageNow, int pageSize, String goodsName){
        com.twoGroup.boot.pojo.Page<GoodsAndShopAndGoodsTypeAndGoodsBrand> page = adminService.likeGoodsByPage(pageNow,pageSize,goodsName);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",page);
        return map;
    }
    @ApiOperation(value = "分页下的查询所有店铺" ,notes = "post方法")
    @PostMapping("/selectShopByPage")
    @ResponseBody
    public Map<String, Object> selectShopByPage(int pageNow, int pageSize){
        com.twoGroup.boot.pojo.Page<ShopAndUser> page = adminService.selectShopByPage(pageNow,pageSize);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",page);
        return map;
    }
    @ApiOperation(value = "分页下的模糊查询店铺",notes = "根据shopName查询")
    @PostMapping("/likeShopByPage")
    @ResponseBody
    public Map<String, Object> likeShopByPage(int pageNow, int pageSize, String shopName){
        com.twoGroup.boot.pojo.Page<ShopAndUser> page = adminService.likeShopByPage(pageNow,pageSize,shopName);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",page);
        return map;
    }
    @ApiOperation(value = "分页下的查询所有申请成为商家的用户" ,notes = "post方法")
    @PostMapping("/selectUserToBeShopperByPage")
    @ResponseBody
    public Map<String, Object> selectUserToBeShopperByPage(int pageNow, int pageSize){
        com.twoGroup.boot.pojo.Page<User> page = adminService.selectUserToBeShopperByPage(pageNow,pageSize);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",page);
        return map;
    }
    @ApiOperation(value = "分页下的模糊查询申请成为商家的用户",notes = "根据nickName查询")
    @PostMapping("/likeUserToBeShopperByPage")
    @ResponseBody
    public Map<String, Object> likeUserToBeShopperByPage(int pageNow, int pageSize, String nickName){
        com.twoGroup.boot.pojo.Page<User> page = adminService.likeUserToBeShopperByPage(pageNow,pageSize,nickName);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",page);
        return map;
    }
    @ApiOperation(value = "分页下的查询所有申请上架的商品" ,notes = "post方法")
    @PostMapping("/selectGoodsToBePutOnSaleByPage")
    @ResponseBody
    public Map<String, Object> selectGoodsToBePutOnSaleByPage(int pageNow, int pageSize){
        com.twoGroup.boot.pojo.Page<GoodsAndShopAndGoodsTypeAndGoodsBrand> page = adminService.selectGoodsToBePutOnSaleByPage(pageNow,pageSize);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",page);
        return map;
    }
    @ApiOperation(value = "分页下的模糊查询申请上架的商品",notes = "根据goodsName查询")
    @PostMapping("/likeGoodsToBePutOnSaleByPage")
    @ResponseBody
    public Map<String, Object> likeGoodsToBePutOnSaleByPage(int pageNow, int pageSize, String goodsName){
        com.twoGroup.boot.pojo.Page<GoodsAndShopAndGoodsTypeAndGoodsBrand> page = adminService.likeGoodsToBePutOnSaleByPage(pageNow,pageSize,goodsName);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("page",page);
        return map;
    }
}
